package com.jaws.demo.common.sharding.util;

import com.jaws.core.common.util.SnowflakeIdUtil;
import com.jaws.demo.common.enums.TableSequenceEnum;
import org.springframework.stereotype.Component;

/**
 * 通用ID生成工具类
 * 
 * @author maojian
 * @date 2017-05-27 16:34:55
 * @since v1.0.0
 */
@Component
public class CommonIdUtils {

	/**
	 * 32位长度
	 * 
	 * @author maojian
	 * @date 2017-05-27 16:35:09
	 * @since v1.0.0
	 * @param tableSequence TableSequenceEnum
	 * @return table segment
	 */
	public String generateId(TableSequenceEnum tableSequence) {
		return tableSequence.getPrefix() + SnowflakeIdUtil.generate();
	}

}
